/*
 * @Author: your name
 * @Date: 2020-07-15 16:57:07
 * @LastEditTime: 2020-08-04 14:31:46
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \yudianjiangtest\src\router\index.js
 */ 
import Vue from 'vue';
import VueRouter from 'vue-router';
import Home from '../views/Home.vue';

Vue.use(VueRouter);

const routes = [
  {
    path: '/',
    name: 'Home',
    redirect: '/Login',
    component: Home
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =>
      import(/* webpackChunkName: "about" */ '../views/About.vue')
  },
  {
    path: '/Test',
    name: 'test',
    component: () => import('@/views/Test'),
    meta: { requireAuth: true, keepAlive: false },
  },
  {
    path: '/Login',
    name: 'Login',
    component: () => import('@/views/login'),
    meta: { requireAuth: true, keepAlive: false },
  },
  // {
  //   path: '/User',
  //   name: 'User',
  //   component: () => import('@/views/Home/user'),
  //   meta: { requireAuth: true, keepAlive: false }
  // },
  {
    path: '/HomeIndex',
    name: 'HomeIndex',
    component: () => import('@/views/Home/index'),
    meta: { requireAuth: true, keepAlive: false },
    children: [
      {
        path: '/HomePage',
        component: () => import('@/views/Home/index'),
        meta: { requireAuth: false, keepAlive: false }
      },
      {
        path: '/Head',
        component: () => import('@/views/Common/head'),
        meta: { requireAuth: false, keepAlive: false }
      },
      {
        path: '/Footer',
        component: () => import('@/views/Common/footer'),
        meta: { requireAuth: false, keepAlive: false }
      },
      {
        path: '/user',
        component: () => import('@/views/Home/user'),
        meta: { requireAuth: true, keepAlive: false }
      },
    ]
  }
];

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
});

export default router;
